import { extend } from 'umi-request';
import settings from "../settings.js"

const request = extend({
  prefix: settings.prefix+'/trailer',
  // prefix: 'http://192.168.31.33:5000/trailer',
  // prefix: 'http://192.168.31.84:5000/trailer',
  // prefix: 'http://127.0.0.1:5000/trailer',
//   timeout: 1000,
  headers: {
    'Content-Type': 'multipart/form-data',
  },
});


// 根据拖车号模糊查找，返回一个列表，列表中的元素是一个Trailer对象
export async function getStatus(options){
    return request('/getStatus',{
        method: "GET",
        ...(options || {}),
    });
}

export async function getTrailers(options){
    return request('/getTrailers',{
        method: "GET",
        ...(options || {}),
    });
}

export async function getTrailerName(options){
    return request('/getTrailerName',{
        method: "GET",
        ...(options || {}),
    });
}

// 根据trailer_ID精确查找trailer
export async function getTrailer(trailer_ID){
  return request('/getTrailer',{
      method: "GET",
      params: {trailer_ID},
      // ...(options || {}),
  });
}

// 获取所有trailer_id
export async function getAllTrailers(){
  return request('/getAllTrailers',{
      method: "GET",
  });
}